package com.ruoyi.project.integral.controller;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.integral.domain.IntegralGoods;
import com.ruoyi.project.integral.service.IIntegralGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 积分商品Controller
 * 
 * @author wyh
 * @date 2024-08-09
 */
@RestController
@RequestMapping("/integral/goods/api")
public class IntegralGoodsApiController extends BaseController
{
    @Autowired
    private IIntegralGoodsService integralGoodsService;

    /**
     * 查询积分商品列表
     */
    @GetMapping("/list")
    public TableDataInfo list(IntegralGoods integralGoods)
    {
        integralGoods.setShelfStatus("是");
        startPage();
        List<IntegralGoods> list = integralGoodsService.selectIntegralGoodsList(integralGoods);
        return getDataTable(list);
    }

    /**
     * 获取积分商品详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(integralGoodsService.selectIntegralGoodsById(id));
    }
}
